package tj.warning.pull.mapper.report3;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tj.warning.pull.model.SyncRecord;

import java.util.List;
import java.util.Map;

public interface Report3Mapper {

    @Select({"select table_name from USER_TABLES"})
    List<String> tableNames();

    void createTable(@Param("tableName") String paramString, @Param("timeStamp") long paramLong);

    void insertBatchByTableName(@Param("tableName") String paramString, @Param("dataList") List<Map<String, String>> paramList);

    void syncData(@Param("jhList") List<String> paramList, @Param("endTime") String paramString);

    String selectMaxTime(@Param("jh") String paramString);

    String selectMaxTimeFromDblink(@Param("jh") String paramString);

    List<Map<String, String>> selectDataByMaxTime(@Param("jh") String paramString1, @Param("maxTime") String paramString2);

    @Select({"<script>select count(*) from ${jh} @LJSS<where><if test='startTime!=null'>and time &gt; #{startTime}</if><if test='endTime!=null'>and time &lt; #{endTime}</if></where></script>"})
    long dataCounts(@Param("jh") String paramString1, @Param("startTime") String paramString2, @Param("endTime") String paramString3);

    @Insert({"insert into ${jh} SELECT * FROM ${jh} @LJSS where time < #{endTime}"})
    long syncHistoryData(@Param("jh") String paramString1, @Param("endTime") String paramString2);

    void syncCurrentData(@Param("record") SyncRecord paramSyncRecord);

    @Update({"drop table ${tableName}"})
    void dropTable(@Param("tableName") String paramString);
}
